package com.google.code.p.restrpc.directory;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * @author dz
 */
public class RemoteServiceDefinitionPack {
    
    public static final RemoteServiceDefinitionPack EMPTY = new RemoteServiceDefinitionPack("",
                                                                                            false,
                                                                                            -1l,
                                                                                            null);
    
    /**
     * @return
     */
    public static final RemoteServiceDefinitionPack emptyInstance() {
        return EMPTY;
    }
    
    private String serviceName;
    
    private boolean modified;
    
    private long lastModifiedMillis = -1l;
    
    private RemoteServiceDefinition[] remoteServiceDefinitions;
    
    public RemoteServiceDefinitionPack() {
        
    }
    
    /**
     * @param modified
     * @param remoteServiceDefinitions
     */
    public RemoteServiceDefinitionPack(String serviceName,
                                       boolean modified,
                                       long lastModifiedMillis,
                                       RemoteServiceDefinition[] remoteServiceDefinitions) {
        this.serviceName = serviceName;
        this.modified = modified;
        this.lastModifiedMillis = lastModifiedMillis;
        this.remoteServiceDefinitions = remoteServiceDefinitions;
    }
    
    /**
     * @param serviceName
     *            the serviceName to set
     */
    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }
    
    /**
     * @param modified
     *            the modified to set
     */
    public void setModified(boolean modified) {
        this.modified = modified;
    }
    
    /**
     * @param lastModifiedMillis
     *            the lastModifiedMillis to set
     */
    public void setLastModifiedMillis(long lastModifiedMillis) {
        this.lastModifiedMillis = lastModifiedMillis;
    }
    
    /**
     * @param remoteServiceDefinitions
     *            the remoteServiceDefinitions to set
     */
    public void setRemoteServiceDefinitions(RemoteServiceDefinition[] remoteServiceDefinitions) {
        this.remoteServiceDefinitions = remoteServiceDefinitions;
    }
    
    /**
     * @return the serviceName
     */
    public String getServiceName() {
        return serviceName;
    }
    
    /**
     * @return the modified
     */
    public boolean isModified() {
        return modified;
    }
    
    /**
     * @return the lastModifiedMillis
     */
    public long getLastModifiedMillis() {
        return lastModifiedMillis;
    }
    
    /**
     * @return the remoteServiceDefinitions
     */
    public RemoteServiceDefinition[] getRemoteServiceDefinitions() {
        return remoteServiceDefinitions;
    }
    
    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).reflectionToString(this);
    }
}
